package com.hongyuan.sellfitness.ui.home.activity;

import android.os.Bundle;
import android.util.Log;

import androidx.lifecycle.ViewModelProviders;

import com.hongyuan.sellfitness.R;
import com.hongyuan.sellfitness.base.AppViewModelFactory;
import com.hongyuan.sellfitness.base.CustomActivity;
import com.hongyuan.sellfitness.databinding.ActivityCoachProfileBinding;
import com.hongyuan.sellfitness.ui.home.beans.CoachDeatilsBean;
import com.hongyuan.sellfitness.ui.home.view_mode.CoachProfileViewModel;

import me.tatarka.bindingcollectionadapter2.BR;

public class CoachProfileActivity extends CustomActivity<ActivityCoachProfileBinding, CoachProfileViewModel> {

    private CoachDeatilsBean bean;

    @Override
    public int initContentView(Bundle savedInstanceState) {
        return R.layout.activity_coach_profile;
    }

    @Override
    public int initVariableId() {
        return BR.viewModel;
    }

    @Override
    public CoachProfileViewModel initViewModel() {
        //使用自定义的ViewModelFactory来创建ViewModel，如果不重写该方法，则默认会调用NetWorkViewModel(@NonNull Application application)构造方法
        AppViewModelFactory factory = AppViewModelFactory.getInstance(getApplication());
        return ViewModelProviders.of(this, factory).get(CoachProfileViewModel.class);
    }

    @Override
    public void initParam() {
        super.initParam();
        bean = (CoachDeatilsBean) getIntent().getSerializableExtra("profiles");
    }

    @Override
    public void initView() {
        super.initView();

        setOnRefresh(binding.refresh,REFRESH_0X4);
        binding.comBack.setOnClickListener(view -> finish());
    }

    @Override
    public void initData() {
        super.initData();
        
        viewModel.setMyEntity(bean);

    }
}
